package com.ruoyi.common.core.domain.entity;

import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.annotation.*;
import com.ruoyi.common.core.validate.EditGroup;
import com.ruoyi.common.cron.CronJob;
import lombok.Data;
import lombok.EqualsAndHashCode;

import com.ruoyi.common.core.domain.BaseEntity;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotNull;

/**
 * 定时任务对象 sys_job
 *
 * @author ruoyi
 * @date 2025-06-04
 */
@Data
@EqualsAndHashCode(callSuper = true)
@TableName("sys_job")
public class SysJob extends BaseEntity {

    private static final long serialVersionUID=1L;

    /**
     * 任务id
     */
    @TableId(value = "job_id")
    @NotNull(message = "任务id不能为空", groups = {EditGroup.class})
    private Long jobId;
    /**
     * 任务名称
     */
    private String jobName;
    /**
     * 任务分组
     */
    private String jobGroup;
    /**
     * 执行方法
     */
    private String invokeTarget;
    /**
     * 任务名称
     */
    private String cronExpression;
    /**
     * 状态 0正常 1暂停
     */
    private Integer status;
    /**
     * 排序码
     */
    private Integer sort;
    /**
     * 备注
     */
    private Integer remark;


    public CronJob toCronJob() {
        return BeanUtil.copyProperties(this, CronJob.class);
    }

}
